<template>
	<view class="tixianorder">
		<view class="top">
			<image src='../../static/businessImg/back.png'  class="topback" @click="back">
			</image>
			<view class="topname">
				提现订单
			</view>
		</view>

		<view class="dataview">
			<view class="datadiv">
				<uni-datetime-picker v-model="datetimerange" type="daterange" rangeSeparator="至" />
			</view>
			
			<view class="databtn" @click="queryData">
				查询
			</view>
		</view>
		
		<view class="selsetview">
			<view class="selsetviewitem" v-for="item in selsetlist" :key="item.id" @click="changeCurrentId(item.id)">
				<view class="selsetviewitemname" >
					{{item.label}}
				</view>
				
				<view class="selsetviewitemunder" v-show="item.id == currentId">
					
				</view>
			</view>
		</view>
		
		<view class="centerview">
			<view class="centerviewitem" v-for="item in list">
				<view class="centerviewstatus">
					{{item.status == 0 ? '审核中' : item.status == 1 ? '完成订单' : '失败订单'}}
				</view>
				
				<view class="centervieworder">
					<view class="centerviewordername">
						订单号：
					</view>
					<view class="centerviewordercneter">
						{{item.orderNumber}}
					</view>
				</view>
				
				<view class="centervieworder">
					<view class="centerviewordername">
						申请时间：
					</view>
					<view class="centerviewordercneter">
						{{item.createTime}}
					</view>
				</view>
				
				
				<view class="centervieworder">
					<view class="centerviewordername">
						订单金额：
					</view>
					<view class="centerviewordercneter">
						￥{{item.price}}
					</view>
				</view>
				
				
				
				<view class="centervieworder">
					<view class="centerviewordername">
						到账渠道：
					</view>
					<view class="centerviewordercneter">
						{{item.card}}
					</view>
				</view>
				
				
				<view class="centervieworder" v-if="currentId == -1">
					<view class="centerviewordername">
						失败原因：
					</view>
					<view class="centerviewordercneter">
						{{item.remake}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	
	import storage from '@/utils/storage.js';
	import {
		withdrawalList
	} from '@/api/gongyingshang.js'
	export default {
		data() {
			return {
				datetimerange: [],
				selsetlist: [{id: 0, label: '审核订单'},{id: 1, label: '完成订单'}, {id: -1, label: '失败订单'}],
				currentId: 1,
				page: 1,
				limit: 10,
				list: []
			}
		},
		
		onShow() {
			this.initData()
		},
		methods: {
			initData(){
				withdrawalList({
					page: this.page,
					limit: this.limit,
					status: this.currentId,
					startTime: this.datetimerange[0] || "",
					endTime: this.datetimerange[1] || "",
					supplierId: storage.getUserInfo().storeId
				}).then(res => {
						this.list = [...this.list, ...res.data.list]
				})
			},
			
			queryData(){
				this.initData()
			},
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			changeCurrentId(id){
				this.currentId =id;
				this.page = 1;
				this.limit = 10;
				this.list = []
				this.initData()
			}
		},
		onReachBottom(){
		 console.log('触底了')
		
		},
	}
</script>

<style scoped>
	.tixianorder {
		width: 100%;
		min-height: 100vh;
		background: #FFFFFF;
	}

	.top {
		width: 100%;
		height: 188rpx;
		position: relative;
		background: #FFFFFF;
	}

	.topback {
		width: 16rpx;
		height: 29rpx;
		position: absolute;
		top: 106rpx;
		left: 32rpx;
	}

	.topname {
		width: 300rpx;
		height: 32rpx;
		text-align: center;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		font-size: 33rpx;
		color: #222222;
		line-height: 32rpx;
		position: absolute;
		top: 104rpx;
		left: 50%;
		transform: translateX(-50%);
	}
	
	.dataview {
		width: 100%;
		height: 99rpx;
		display: flex;
		padding: 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-top: 2rpx solid #f3f3f3;
		border-bottom: 2rpx solid #f3f3f3;
	}
	
	.datadiv {
		width: 548rpx;
	}
	
	.databtn {
		height: 67rpx;
		width: 126rpx;
		line-height: 67rpx;
		text-align: center;
		background: rgb(148, 207, 57);
		font-family: PingFang;
		font-weight: 500;
		font-size: 29rpx;
		color: #FFFFFF;
	}
	
	.selsetview {
		width: 100%;
		height: 60rpx;
		padding: 0 70rpx;
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
		border-bottom: 2rpx solid #f3f3f3;
	}
	
	.selsetviewitem {
		width: 105rpx;
		height: 37rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		align-content: space-between;
	}
	
	.selsetviewitemname {
		width: 100%;
		height: 26rpx;
		line-height: 26rpx;
		text-align: center;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 27rpx;
		color: #101624;
	}
	
	.selsetviewitemunder {
		width: 100%;
		height: 7rpx;
		background: rgb(40, 199, 73);
	}
	
	.centerview {
		width: 100%;
		padding: 20rpx 20rpx;
		margin: 0 auto;
		display: flex;
		flex-wrap: wrap;
	}
	
	.centerviewitem {
		width: 100%;
		padding: 28rpx 21rpx;
		border: 2rpx solid #f3f3f3;
	}
	
	.centerviewstatus {
		width: 100%;
		height: 78rpx;
		border-bottom: 2rpx solid #f3f3f3;
		line-height: 78rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 27rpx;
		color: #101624;
	}
	
	.centervieworder {
		width: 100%;
		height: 78rpx;
		line-height: 78rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 27rpx;
		color: #101624;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.centerviewordername {
		width: 150rpx;
		height: 100%;
	}
	
	.centerviewordercneter {
		flex: 1;
		height: 100%;
		padding-left: 42rpx;
		text-align: left
	}
</style>
